<template>
	<!-- 儿童免疫数据 -->
	<view class="childDate">
		<view v-for="(item,index) of list" :key='index' @click="listItem(item.images,item.name)">
			<image :src="item.image" mode="aspectFill"></image>
			<view>
				<view class="name">{{item.name}}</view>
				<view class="time">上传时间:{{item.createtime | handeltime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			};
		},
		filters:{
			// 时间戳转时间
			handeltime:time => (new Date(parseInt(time*1000))).toLocaleDateString() ,
		},
		onShow() {
			this.def_list()
		},
		methods:{
			def_list(){
				this.$u.get('/index/chiim').then(res=>{
					this.list = res.data
				})
			},
			listItem(img,name){
				uni.navigateTo({
					url:'./detail/detail?img='+JSON.stringify(img)+'&title='+name
				})
			}
		}
	}
</script>

<style lang="scss">
	.childDate{
		>view{
			display: flex;
			align-items: center;
			width: 95%;
			margin: 20rpx auto;
			padding: 20rpx;
			box-sizing: border-box;
			border-radius: 20rpx;
			background-color: #FFFFFF;
			image{
				margin-right: 10rpx;
				width: 80rpx;
				height: 80rpx;
			}
			.name{
				font-weight: bold;
			}
			.time{
				font-size: 24rpx;
				color: rgba(0,0,0,.5);
				margin-top: 10rpx;
			}
		}
	}
</style>
